<include file="public:header"/>
<include file="public:sidebar"/>
<script type="text/javascript" charset="utf-8" src="__STATIC__/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__STATIC__/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="__STATIC__/ueditor/lang/zh-cn/zh-cn.js"></script>
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            文章管理
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li class="active">文章</li>
        </ol>
    </section>
    <!-- Main content -->
    <section class="content">
        <div class="col-md-12">
            <div style="margin: 10px;">
                <button onclick="history.go(-1)" class="layui-btn layui-btn-sm layui-btn-radius layui-btn-danger">
                    <i class="layui-icon">&#xe65c;</i>返回
                </button>
            </div>
            <!-- Horizontal Form -->
            <div class="box box-info">
                <div class="box-header with-border">
                    <h3 class="box-title">添加/修改评论人</h3>
                </div>
                <!-- /.box-header -->
                <!-- form start -->
                <form action="{:Url('member/insert_comment')}" method="post" class="form-horizontal layui-form"
                      autocomplete="off">
                    <div class="box-body">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">
                                <span class="text-danger">*</span>用户
                            </label>
                            <div class="col-sm-4">
                                <input type="text" class="form-control"
                                       placeholder="用户" name="title"
                                       lay-verify="required"
                                       value="<notempty name='info'>{$info.nickname}</notempty>">
                                <input type="hidden" name="id"
                                       value="<notempty name='info'>{$info.id}</notempty>">
                            </div>
                        </div>
                        <empty name="mc_id">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">
                                    <span class="text-danger">*</span>商户
                                </label>
                                <div class="col-sm-4">
                                    <input type="text" class="form-control"
                                           placeholder="商户" name="mch"
                                           lay-verify="required" value="<notempty name='info'>{$info.mch}</notempty>">
                                    <input type="hidden"
                                           name="mc_id" value="<notempty name='info'>{$info.mc_id}</notempty>">
                                </div>
                            </div>
                            <else />
                            <input type="hidden" name="mc_id" value="{$mc_id}">
                        </empty>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">
                                状态
                            </label>
                            <div class="col-sm-10">
                                <div class="radio">
                                    <label>
                                        <input type="radio" <empty name='info'>checked<else/><eq name="info.status" value="1">checked</eq></empty> name="status" value="1">是
                                    </label>
                                    <label>
                                        <input type="radio" <notempty name='info'><eq name="info.status" value="2">checked</eq></notempty> name="status" value="2">否
                                    </label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">
                            </label>
                            <div class="col-sm-4">
                                <button type="submit" class="btn btn-info" lay-submit lay-filter="*">确定</button>
                                <button type="reset" class="btn btn-default">取消</button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </section>
    <!-- /.content -->
</div>
<style>
    .layui-form-radio {
        line-height: 30px;
        margin: 0 0 0 0;
        padding-right: 0;
    }
    .layui-layer-shade{
        z-index: 99999;
    }
    .layui-layer-dialog{
        z-index: 999999;
    }
    .checkbox label, .radio label:first-child{
        padding-left: 0;
    }
</style>
<script>
    var ue = UE.getEditor('editor',{
        autoHeightEnabled: false,
        autoFloatEnabled: false,
        allowDivTransToP: false
    });
    layui.use(['form','layer','upload'],function () {
        var form = layui.form,
            layer = layui.layer,
            upload= layui.upload;

        layer.config({
            zIndex:99999999
        });
        //执行实例
        var uploadInst = upload.render({
            elem: '#test1',
            field: 'image',
            url: '{:Url("uploadify/upload")}',
            done: function(res){
                if(res.status===1){
                    $('img.images').attr('src',res.path);
                    $('.show-image').show();
                }
            },error: function(){}
        });
        form.on('submit(*)', function(data){
            data.field.image = $('img.images').attr('src');
            $.post(data.form.action,data.field,function (result) {
                if(result.code){
                    layer.msg(result.msg);
                    return false;
                }
                layer.alert(result.msg,{icon:6,end:function () {
                        location.href = result.data.redirect;
                    }});
            });
            return false;
        });
        $(document).on('click','.fa-close',function (e) {
            e.preventDefault();
            $('img.images').attr('src','');
            $('.show-image').hide();
        })
    });
</script>
<include file="public:footer"/>